<!DOCTYPE html>
<html>
  <head>
<div th:include="base-libs :: base-libs" />
    <title>团队审核</title>
	
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    
    <style>
    	body{
    		overflow-x:hidden;
    		padding: 0px 10px;
    	}
    	.title{
			height:40px;
			line-height:40px;
			font-size:16px;
			background:#F7F9FB;
			margin-left:0;
			position:relative;
			padding-left:5px;
		}
		#foot button{
			margin-left:10px;
		}
		.spanBtn{
			font-weight: bold;
			color: blue;
			cursor:pointer;
		}
    </style>
    
    <script>
    	var tdManagerData;
    	var shData;
    	$(function(){
    		initView();
    		initData();
    	})
    	
    	function initView(){
            $("[disabled=disabled]").css("color","#000");
    		/* 成员列表 */
    		$("#cylbTable").datagrid({
				idField : "USERID",
				uniqueId: "USERID",
				striped : true,
				border:false,
				clickToSelect: true,
				fit:true,
				fitColumns:true,
				scrollbarSize:0,
				singleSelect: true,
				columns : [[
						{field:'XM', title:'医生姓名', width: 80, align: 'center'}
					,{field : 'SFZH',title : '身份证号', width: 80, align: 'center'}
					,{field:'YLJGMC', title:'第一执业机构', width: 80, align: 'center'}
					,{field:'TDJS', title:'团队角色', width: 80, align: 'center',formatter:function(value,row,index){
						var jsObj = {'1':'团队长','2':'普通成员','3':'团队助手'};
						return jsObj[value];
					}}
					,{field:'RTSJ', title:'入团时间', width: 80, align: 'center',formatter:function(value,row,index){
						row.RTSJ = row.RTSJ.substring(0,10);
						return value.substring(0,10);
					}}
					,{field:'SJHM', title:'手机号码', width: 80, align: 'center'}
					,{field:'USERID', title:'详细', width: 60, align: 'center',formatter:function(value,row,index){
						//return '<a href="javascript:void(0)" onclick=queryYsxx("'+value+'")>医生详细</a>';
                        return '<span class="spanBtn" onclick="queryYsxx(\'' + value + '\')">医生详细</span>';
					}}
				]],
				method : "post",
				url : contextRoot + "tdgl/queryTdcylbAll.service",
				onBeforeLoad : function(params) {
					params["TDID"] = $("#cylbTable").data("TDID");
					if(params["TDID"]){
						return params;
					}else{
						return false;
					}
				},
				onLoadSuccess: function(data){
					$("#myBox").css("height",(data.rows.length)*37+83);
					$("#myLayout").layout("resize");
 				},
				onClickRow : function(row, tr, field){
					$(tr).siblings("tr").removeClass("changetr");
					$(tr).addClass("changetr");
				},
				queryParamsType : ""
			});
    	}
    	
        /** 查询医生详细 */
    	function queryYsxx(userId){
        	StoreCache.setCache("tdYsid",userId);
    		window.open(contextRoot + 'tdgl/ysInformation.html');
    	}
    	
    	function initData(){
    		tdManagerData = StoreCache.removeCache("tdManagerData");
    		
    		$.QuickRemote.AjaxJson(contextRoot + "tdgl/queryTdshxx", queryTdshxxBack, {TDID:tdManagerData.TDID});
    		
   			var shztObj = {'0':'新建','1':'待审核','2':'正常','3':'审核不通过','4':'已解散'};
   			
   			tdManagerData.SHZT_ = shztObj[tdManagerData.SHZT];
   			$("#tdjbxxTable [type=text]").each(function(){
   				var key = $(this).attr("name");
   				$(this).val(tdManagerData[key]);
   			})
    		$("#cylbTable").data("TDID",tdManagerData.TDID).datagrid("reload")
    		
    		
    	}
    	
    	/** 查询审核信息回调 */
    	function queryTdshxxBack(result){
    		if(result.state){
    			shData = result;
   				result.SHTJSJ = result.SHTJSJ.substring(0,10);
   				result.SHYH='医院管理员';
   				for(var key in result){
   					$("#shxxForm [name="+ key +"]").val(result[key]);
   				}
    		}else{
    			$.QuickAlert.alertFail({content: "审核信息丢了，稍后再加载一次吧！"});
    		}
    	}
    	
    	
    	/** 跳转到列表页面  */
    	function toIndex(){
    		$.QuickUrlUtils.redirectUrl("index.html");
    	}
    	
    	/** 查看团队日记  */
    	function toLogs(){
    		StoreCache.setCache("tdManagerData",tdManagerData);
    		parent.layer.open({
				  type: 2,
				  area: ["60%", "500px"],
				  content: contextRoot + 'tdgl/logs.html',
				  scrollbar: false,
				  resize: false,
				  title:'团队日志',
				  end: function(){
					  if(StoreCache.removeCache("refresh",true)){
						  $.QuickUrlUtils.redirectUrl("yfprw.html");
					  }
				  }
			});
    	}
    	
    	/** 审核通过  */
       	function checkPass(){
       		$.QuickAlert.alertConfirm({
   				content : "确认审核通过？",
   				callback : function() {
   					var params = {
   							SHID:shData.SHID,
   							TDID:shData.TDID,
   							type:'pass'
   					}
   					$.QuickRemote.AjaxJson(contextRoot + "tdgl/checkTdxx", checkBack, params);
   				}
   			})
	   	}
    	
    	
    	/** 审核不通过  */
       	function  checkNoPass(){
       		$.QuickAlert.alertConfirm({
   				content : "确认审核不通过？",
   				callback : function() {
		       		var index = parent.layer.prompt({
		       			formType:2, //多行文本框
		       	        title : '不通过原因',
		       	     	maxlength : 100,
				       	},function(val, index){
			 				var params = {
									SHID:shData.SHID,
									TDID:shData.TDID,
									SHBTGYY:val,
									type:'noPass'
							}
							$.QuickRemote.AjaxJson(contextRoot + "tdgl/checkTdxx", checkBack, params);
				       		parent.layer.close(index);
				       	});
   				}
   			})
       	}
       	/** 审核结果回调  */
       	function checkBack(result){
       		$.QuickAlert.alertNormal(result.info.success, {callback: function(){
       			$.QuickUrlUtils.redirectUrl("index.html");
    		}});
       	}
    </script>
  </head>
  
  <body class="easyui-layout" border="false">
  	 <div region="center" border="false">
  	 	<div style="height:170px;overflow:hidden;">
			<div  class="easyui-layout" fit="true" border="false">
				<div region="center" border="false" style="overflow:hidden">
					<div class="title">
						<span>团队基本信息</span>
						<button class="btn btn-primary" onclick="toLogs()" style="position:absolute;top:5px;right:26px">查看团队日志<tton>
					</div>
					<table class="form-table" id="tdjbxxTable">
						<tr>
							<td class="td-text">团队名称</td>
							<td>
								<input type="text" class="form-control" name="TDMC" disabled="disabled"/>
							</td>
							<td class="td-text">团队状态</td>
							<td>
								<input type="text" disabled="disabled" class="form-control" name="SHZT_"/>
							</td>
							<td class="td-text">所属医疗机构</td>
							<td>
								<input type="text" disabled="disabled" class="form-control" name="YLJGMC"/>
							</td>
						</tr>
						<tr>
							
							<td class="td-text">团队队长</td>
							<td>
								<input type="text" disabled="disabled" class="form-control" name="DZXM" />
							</td>
							<td class="td-text">手机号码</td>
							<td>
								<input type="text" class="form-control" name="LXDH" />
							</td>
							<td class="td-text">创建时间</td>
							<td>
								<input type="text" disabled="disabled" class="form-control" name="CJSJ"/>
							</td>
						</tr>
						<tr>
							<td class="td-text">联系地址</td>
							<td>
								<input type="text" class="form-control" name="LXDZ" disabled="disabled" />
							</td>
							<td class="td-text">团队简介</td>
							<td colspan="3">
								<input type="text" class="form-control" name="TDJJ" style="width:95.7%" disabled="disabled" />
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
		
		
		<div style="margin-top:5px;" id="myBox">
   			<div class="easyui-layout" fit="true" border="false" id="myLayout">
   				<div region="north" style="height:40px;overflow:hidden" border="false">
   					<div class="title">成员列表</div>
   				</div>
   				<div region="center" border="false">
   					<table id="cylbTable" fit="true" style="border:1px solid #ddd"></table>
   				</div>
   			</div>
   		</div>
   		
   		
   		<div style="height:120px;margin-top:8px;">
   			<div class="easyui-layout" fit="true" border="false">
   				<div class="title">提交信息</div>
   				<table class="form-table" id="shxxForm" style="margin-top:10px;">
						<tr>
							<td class="td-text">提交时间</td>
							<td>
								<input type="text" class="form-control check" name="SHTJSJ" disabled="disabled"/>
							</td>
							<td class="td-text">审核用户</td>
							<td>
								<input type="text" disabled="disabled" class="form-control" name="SHYH"/>
							</td>
						</tr>
					</table>
   			</div>
   		</div>
   		
  	 </div>
  	 
  	 
  	 <div region="south" style="height:55px;line-height:55px;text-align:center;overflow:hidden;border:0;border-top:1px solid #ddd" id="foot">
		  <button class="btn btn-primary" onclick="checkPass()">审核通过<tton>
		  <button class="btn btn-primary" onclick="checkNoPass()">审核不通过<tton>
 	 	  <button class="btn btn-default" onclick="toIndex()">返回<tton>
  	 </div>
  </body>
</html>
